public class Solution {
    public int minCostClimbingStairs(int[] cost) {
        int len = cost.length;
        int[] ret = new int[len + 1];
        for (int i = 2; i <= len; i++) {
            ret[i] = Math.min(ret[i - 1] + cost[i - 1], ret[i - 2] + cost[i - 2]);
        }
        return ret[len];
    }
}
